home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / math / gle-3.000 / gle-3 / gle / dviscr.c < prev    next >
C/C++ Source or Header  |  1995-02-07  |  1KB  |  59 lines

  1. #define XSIZECM 18        /* at 120 DPI  */
  2. #define YSIZECM 24        /* at 72 DPI */
  3. #define NXBITS 620
  4. #define NYBITS 400
  5.  
  6. #include "bitmap.h"
  7. dvitype(void)
  8. {
  9.     printf("Deskjet/Laserjet");
  10. }
  11. #include <graphics.h>
  12. bitmap_print()
  13. {
  14.     int x,y,z;
  15.     int d_graphmode=0,g_driver=0,g_error;
  16.     double f;
  17.     unsigned char *line;
  18.     printf("press return to enter graphics \n");
  19.     getch();
  20.     detectgraph(&g_driver, &d_graphmode);
  21.     if (g_driver<0) {
  22.         printf("No graphics hardware detected !!!!! \n");
  23.         gle_abort("Could not load BGI graphics\n");
  24.     }
  25.     initgraph(&g_driver,&d_graphmode,"");
  26.     g_error = graphresult();
  27.     if (g_error<0) {
  28.         printf("Init graph error %s\n",grapherrormsg(g_error));
  29.         gle_abort("Init graph error\n");
  30.     }
  31.  
  32.     for (y=0; y<400; y++) {
  33.       line = bitmap_line(nybits-y);
  34.       for (x=0; x<620 ; x++) {
  35.         z = 1 << (x % 8);
  36.         if ((z & line[x/8]) != 0) {
  37.              putpixel(x,y,2);
  38.         }
  39.  
  40.       }
  41.     }
  42.  
  43.     getch();
  44.  
  45.     closegraph();
  46.  
  47. }
  48. ljsendline(char *s, int nc,int y)
  49. {
  50.     pprintf("\x1b&a%.1fh%.1fV",0.0,((NYBITS-y)/150.0)*720.0); /* move xy */
  51.     pprintf("\x1b*b1M");    /* compact */
  52.     pprintf("\x1b*r1A");    /* start graphics at cur pos */
  53.     pprintf("\x1b*b%dW",nc);    /* send y bytes */
  54.     printmem(s,nc);
  55.     pprintf("\x1b*rB");        /* end grpahics */
  56. }
  57.  
  58.  
  59.